import React from 'react';


export default class Search extends React.Component {
    constructor(props) {
        super(props);
        this.state={
            value:""
        }
    }
    render() {
        const {value}=this.state;
        return (
                <div>
                    <input ref="input" type="text" value={value} onChange={()=>{this.setState({value:this.refs.input.value})}}/>
                    <button onClick={()=>{this.props.onSearch(this.state.value)}}>搜索</button>
                </div>
        )
    }
}